<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

defined('_JEXEC') or die('Restricted access'); 
$row = $this->row;

JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'description' );
$cparams = JComponentHelper::getParams ('com_media');

JHTML::_('behavior.modal');
?>
<script language="javascript" type="text/javascript">
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if (pressbutton == 'cancel') {
		submitform( pressbutton );
		return;
	}
	if (pressbutton == 'save' || pressbutton == 'apply') {
		var form = document.adminForm;
		
	    if( ! checkNumber(form.tax_value.value) ){
	        alert("TAX value is required and must be numberic value");
	        form.tax_value.focus();
	        return false;
	    }
	            
		submitform(pressbutton);		
	}
	else {		
		submitform(pressbutton);
	}
}

// Check numberic value
function checkNumber(value){    
	var numericExpression = /^[0-9]+$/;
	var numericExpression1 = /^[0-9]+\.[0-9]{1,2}$/;
	
	if ( value.match(numericExpression) || value.match(numericExpression1) )
	   return true
	else return false;
}

</script>
	
<form name="adminForm" action="index.php" method="post" enctype="multipart/form-data">
	<fieldset class="adminform">
		<?php echo $this->getTaxTabs();?>
	</fieldset>	
	<table width="100%">
	<tr>
	
		<td width="80%" valign="top" align="left">
		
		    <div style="width:100%;">
				<fieldset class="adminform">
					<legend><?php echo JText::_( 'Regional VAT detail' ); ?></legend>
						<table class="admintable">
						
						<tr>
							<td class="key">
								<label for="posting_plan" width="100">
									<?php echo JText::_( 'Location' ); ?>:					
								</label>
								<br />
								<small>
									<?php echo JText::_('Location to apply TAX');?>
								</small>
							</td>
							<td colspan="2">
								<?php
									$model = &$this->getModel();
								    $location = $model->getLocationTree("location_id", $row->location_id);
								    echo $location;
								?>
							</td>
						</tr>
						
						<tr>
							<td class="key">
								<label for="vat_value" width="100">
									<?php echo JText::_( 'TAX value' ); ?>:
								</label>
							</td>
							<td colspan="2">
								<input class="text_area" type="text" name="tax_value" id="tax_value" value="<?php echo $row->tax_value; ?>" size="10" maxlength="50" /> (%) 
								<font color="Red">*</font>
							</td>
						</tr>
														
						<tr>
							<td width="120" class="key">
								<?php echo JText::_( 'Published' ); ?>:
							</td>
							<td>
								<?php
								$published = ($row->id) ? $row->published : 1;
								$lists['published'] = JHTML::_('select.booleanlist',  'published', 'class="inputbox"', $published );
								 echo $lists['published']; ?>						
							</td>
						</tr>
						
					</table>
				</fieldset>
			</div>
		</td>
	</tr>
	</table>
	<div class="clr"></div>	
	<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
	<input type="hidden" name="view" value="jatax" />	
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="tab" value="region" />
	<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
	<?php echo JHTML::_( 'form.token' ); ?>	
</form>
<style type="text/css">
	table.admintable td.key{
		width:300px;
	}								
</style>